﻿using System.Collections.Generic;
using Cashbook.Views;
using Xamarin.Forms;

namespace Cashbook
{
    public partial class App : Application
    {
        public static bool UseMockDataStore = true;
        public static string BackendUrl = "https://localhost:5000";


        public static IDictionary<string, string> LoginParameters => null;

        public App()
        {
            InitializeComponent();

            GoToMainPage();
            //if (UseMockDataStore)
            //    DependencyService.Register<MockDataStore>();
            //else
            //    DependencyService.Register<CloudDataStore>();

            //SetMainPage();
        }

        //public static void SetMainPage()
        //{
        //    if (!UseMockDataStore && !Settings.IsLoggedIn)
        //    {
        //        Current.MainPage = new NavigationPage(new LoginPage())
        //        {
        //            BarBackgroundColor = (Color)Current.Resources["Primary"],
        //            BarTextColor = Color.White
        //        };
        //    }
        //    else
        //    {
        //        GoToMainPage();
        //    }
        //}

        public static void GoToMainPage()
        {
            // DataAccess db = new DataAccess();
            TabbedPage tabbedPage;
			switch (Device.RuntimePlatform)
			{
				case Device.iOS:
				   tabbedPage = new TabbedPage
					{
						Children = {
                            new NavigationPage(new BillPage())
					{
						Title = "帐单",
						Icon = "ic_library_books.png"
					},
                            new NavigationPage(new BillIsPayedPage())
					{
						Title = "已结",
						Icon = "ic_playlist_add_check.png"
					},
					new NavigationPage(new CustomersPage())
					{
						Title = "客户",
						Icon = "ic_account_circle.png"
					},
					 new NavigationPage(new StatisticsPage())
					{
						Title = "统计",
						Icon = "ic_pie_chart.png"
					},


				}
					};

					
					break;
				case Device.Android:
				case Device.WinPhone:
				case Device.Windows:
				default:
				    tabbedPage = new TabbedPage
					{
						Children = {
                            new NavigationPage(new BillPage())
					{
						Title = "帐单",
					
					},
                            new NavigationPage(new BillIsPayedPage())
					{
						Title = "已结",
						
					},
					new NavigationPage(new CustomersPage())
					{
						Title = "客户",
						
					},
					 new NavigationPage(new StatisticsPage())
					{
						Title = "统计",
					
					},


				}
					};

					
					break;
			}
          Current.MainPage = tabbedPage;

		}
    }
}
